﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace AppDemo
{
    /// <summary>
    /// Interaction logic for Window8.xaml
    /// </summary>
    public partial class Window8 : Window
    {
        public Window8()
        {
            InitializeComponent();

            editor.ValueChanging += new EventHandler<ActiproSoftware.Windows.PropertyChangingRoutedEventArgs<int?>>(editor_ValueChanging);
        }

        void editor_ValueChanging(object sender, ActiproSoftware.Windows.PropertyChangingRoutedEventArgs<int?> e)
        {
           // e.NewValue = e.NewValue + 1;
        }

        private void editor_TextChanging(object sender, ActiproSoftware.Windows.StringPropertyChangingRoutedEventArgs e)
        {
            if (!string.IsNullOrEmpty(e.NewValue))
            {
                int val = Convert.ToInt32(e.NewValue);
                if((val %5)!=0)
                {
                    e.Cancel = true;
                 //   e.Handled=true;
                }
            }
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {

        }

        private void button1_Click_1(object sender, RoutedEventArgs e)
        {
            MediaPlayer player = new MediaPlayer();
            // player.Volume = 1;
            player.MediaOpened += delegate
            {
               
                    player.Play();
              
            };

            player.Open(new Uri(string.Format("{0}.mp3", "abandonment"), System.UriKind.Relative));
        }

        

        private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
        {

        }

        private void TextBox_SelectionChanged(object sender, RoutedEventArgs e)
        {

        }

    }
}
